<?php
ini_set('date.timezone','Asia/Shanghai');//调整时区
session_start();
$robot=$_SESSION['robot'];
$s_time=$_SESSION['s_time'];
$e_time=$_SESSION['e_time'];
$time=$_SESSION['time'];
$table=$_SESSION['table'];
//$robot1="ap4";
//$robot2="ap4x";
//$s_time="2017-04-07 08:00";
//$e_time="2017-04-07 12:00";
//$time=10;
$data=array();
if($time==1){
    $f=floor((strtotime($e_time)-strtotime($s_time))/86400);
    $f=floor((strtotime($e_time)-strtotime($s_time))%86400/3600)+$f*24;
    $temp=$s_time;
    for($i=0;$i<=$f;$i++){
        $date[$temp] =$temp;
        $value[$temp] =0;
        $temp=date('Y-m-d H:i',strtotime("$temp+1hours"));
    }
    $num=13;
}else if($time==10){
  //  $f=floor((strtotime($e_time)-strtotime($s_time))/86400);
  //  $f=floor((strtotime($e_time)-strtotime($s_time))%86400/3600)+$f*24;
    $f=floor((strtotime($e_time)-strtotime($s_time))%86400/600);
    //echo $f."<br/>";
    $temp=$s_time;
    for($i=0;$i<=$f;$i++){
        $date[$temp] =$temp;
        $value[$temp] =0;
        $temp=date('Y-m-d H:i',strtotime("$temp+10minute"));
    }
    $num=15;
}
$data['date']=$date;
$data['value']=$value;
echo json_encode($data);
?>